exports.main_header = function(_args) {
	
	var aps='';
	if(Ti.Platform.osname== 'android') {
  		 Titanium.include('../globals.js');
  		 aps='../';
    }
    else {
   		  Titanium.include('globals.js');
    }
    
	var view = Ti.UI.createView({
	    backgroundImage: _args.backgroundImage,
	    left: _args.left,
	    top: _args.top,
	    height:_args.height,
	    width: _args.width,
	    touchEnabled: _args.touchEnabled,
	});
	
	var lb1 = Titanium.UI.createLabel({
       text:_args.headertext,
       color:'black',
       left:15,
       right:215,
       font:{
			fontSize:Ti.App.Properties.getString('fontsizeLarge'),
			fontWeight:'bold'
		},
    });
    view.add(lb1)
    
    
    var imback = Titanium.UI.createView({
        backgroundImage:_args.imback,
       	height:65,
        width:65,
        touchEnabled: true,
        left:5,
       
    });
    imback.addEventListener('touchstart', function(e)
	{
	   imback.backgroundImage=_args.imback_;
	});
	 
	imback.addEventListener("touchend", function(e)
	{
	 
	   imback.backgroundImage=_args.imback;
	});
	
	imback.addEventListener("touchcancel", function(e)
	{
		imback.backgroundImage=_args.imback;
	});
	 
	imback.addEventListener("click", function(e)
	{
		Ti.App.fireEvent('back_'+_args.idWinParent)
	  	  
	});
	
   
    
    if(_args.imback !== undefined && _args.imback_ !== undefined ) {
       view.add(imback);
       lb1.left=65
    }
     var right=15;
     var i = 0;
     for (i = 0; i < _args.databutton_right.length; i++) {
     	var im = Titanium.UI.createView({
	       backgroundImage:_args.databutton_right[i].Image,
	       height:65,
	       width:65,
	       touchEnabled: true,
	       right:right,
	       index:i
    	});
    	im.addEventListener('touchstart', function(e)
		{
		   var k=e.source.index;
		   e.source.backgroundImage=_args.databutton_right[k].Image_;
		});
		 
		im.addEventListener("touchend", function(e)
		{
		   var k=e.source.index;
		   e.source.backgroundImage=_args.databutton_right[k].Image;
		});
		
		
		im.addEventListener("touchcancel", function(e)
		{
			var k=e.source.index;
			e.source.backgroundImage=_args.databutton_right[k].Image;
		});
		 
		im.addEventListener("click", function(e)
		{
		  
					
		  var k=e.source.index;
	
		  if(_args.databutton_right[k].tag=='Login')
		  {
		  	if(Ti.App.Properties.getInt('isLogin')==1)
			{
				alert('Ban da login')
			}
			else{
				var table = Ti.UI.createTableView();
				var LoginPop = require('windows/LoginPop').CreateLoginPop
				var pop = new LoginPop({
			        title: Globals.login_login,
			        view: table,
			        top:0,
			      
			    });
			    pop.open();
			} 
		  }
		  else if(_args.databutton_right[k].tag=='Category')
		  {
		  	  Ti.App.fireEvent('LectureMain:CreateLectureCategory')
		  }
		  else if(_args.databutton_right[k].tag=='Search')
		  {
		  	  //alert('Đang xây dựng chức năng,vui lòng quay lại sau');
		  	  Ti.App.fireEvent('LectureMain:CreateSearchLecture')
		  }	
		   
		});
		view.add(im);
    	right+=65
     }
    
  	
	
	
	 
	 
	return view;
};